package com.xq.cn.enums;

import cn.hutool.core.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum TypeEnum {

    GOMOKU(1, "五子棋"),

    CHINESE_CHESS(2, "中国象棋"),

    UNKNOWNERROR(null, "未知");


    private final Integer type;
    private final String description;
    public static TypeEnum getByType(Integer type) {
        Assert.notNull(type, "类型为：" + UNKNOWNERROR.type);
        for (TypeEnum appletUserTypeEnum :
                TypeEnum.values()) {
            if (appletUserTypeEnum.type.equals(type)) {
                return appletUserTypeEnum;
            }
        }
        return UNKNOWNERROR;
    }
}
